  /*
   * Author of revised version: Franklyn Pinedo
   *
   * Adapted from Source Code in C of Tutorial/User's Guide for MPI by
   * Peter Pacheco.
   */

//  import mpi.* ;
  import java.net.InetAddress;  
  import java.net.NetworkInterface;
  import java.io.*;
  import java.net.*;
  import java.sql.*;
  import java.util.logging.Level;
  import java.util.logging.Logger;

  class Database {
    static public void main(String[] args)  {//throws MPIException {
  
	Connection con = null;
	PreparedStatement pst = null;
	ResultSet rs = null;

	String url = "jdbc:mysql://127.0.0.1:3333/the_game";
	String user = "******";
	String password = "****************************";

	try {
		System.out.println("Connecting to database...");
		con = DriverManager.getConnection(url, user, password);
		pst = con.prepareStatement("SELECT * FROM users");
		rs = pst.executeQuery();

		while (rs.next()) {
			System.out.print(rs.getInt(1));
			System.out.print(": ");
			System.out.print(rs.getString(2));
			System.out.print(" - ");
			System.out.println(rs.getString(4));
		}
	} catch (SQLException ex) {
		Logger lgr = Logger.getLogger(Database.class.getName());
		lgr.log(Level.SEVERE, ex.getMessage(), ex);
	} finally {
		try {
			if (rs != null) {
				rs.close();
			}
			if (pst != null) {
				pst.close();
			}
			if (con != null) {
				con.close();
			}
		
	} catch (SQLException ex) {
		Logger lgr = Logger.getLogger(Database.class.getName());
		lgr.log(Level.WARNING, ex.getMessage(), ex);	
		}

	}



	 }
  }
